package jdos.cpu.core_dynamic;

import jdos.cpu.Core;
import jdos.cpu.CPU_Regs.Reg;

public class Mod extends Helper {
    static public Reg eb(int rm) {
        switch (rm & 7) {
            case 0: return reg_eax;
            case 1: return reg_ecx;
            case 2: return reg_edx;
            case 3: return reg_ebx;
            case 4: return reg_ah;
            case 5: return reg_ch;
            case 6: return reg_dh;
            case 7: return reg_bh;
        }
        return null;
    }

    static public Reg gb(int rm) {
        switch ((rm >> 3) & 7) {
            case 0: return reg_eax;
            case 1: return reg_ecx;
            case 2: return reg_edx;
            case 3: return reg_ebx;
            case 4: return reg_ah;
            case 5: return reg_ch;
            case 6: return reg_dh;
            case 7: return reg_bh;
        }
        return null;
    }

    static public Reg ew(int rm) {
        switch (rm & 7) {
            case 0: return reg_eax;
            case 1: return reg_ecx;
            case 2: return reg_edx;
            case 3: return reg_ebx;
            case 4: return reg_esp;
            case 5: return reg_ebp;
            case 6: return reg_esi;
            case 7: return reg_edi;
        }
        return null;
    }

    static public Reg gw(int rm) {
        switch ((rm >> 3) & 7) {
            case 0: return reg_eax;
            case 1: return reg_ecx;
            case 2: return reg_edx;
            case 3: return reg_ebx;
            case 4: return reg_esp;
            case 5: return reg_ebp;
            case 6: return reg_esi;
            case 7: return reg_edi;
        }
        return null;
    }

}
